<?php

session_start();

// Include i file necessari
include('inc/config.inc.php');
include('inc/template.inc.php');
include('inc/db.inc.php');
include('inc/check.inc.php');

// Variabili
$list = '';
$query = "SELECT loc_id, loc_name FROM locations WHERE loc_hidden = '0' ORDER BY loc_id ASC";

// Recupera le locazioni dal database
if($results = $db->query($query)) {
    while($row = $results->fetch_assoc()) {
        $list .= '<li><a href="game.php?loc='.$row['loc_id'].'" target="_top">'.htmlentities($row['loc_name']).'</a></li>';
        
    }
    
    $results->close();
}

// Lista delle tag speciali
$tags = array('temp_title' => $g_name, 'temp_list' => $list);

// Carica il template e formatta le tag speciali
$temp = new template('style/map.template.html');
$temp->replace($tags);

// Visualizza l'output
echo $temp->show();

// Chiude la connessione al database
$db->close();

?>